from User.models import User
from django.db import models

'''
        Type:资讯分类表
                typename:资讯分类名
'''

class Type(models.Model):
    typename = models.CharField(max_length=10)

'''
        Information:资讯表
                title:标题
                content:内容
                date:日期
                types:资讯分类ID
                users：用户ID
                power:查看权限
                state:审核状态
                filename:文件名
                isDelete:删除文章
                route:文件夹路径
'''
class Information(models.Model):
        title=models.CharField(max_length=100)
        content=models.CharField(max_length=2000)
        date=models.DateTimeField(auto_now_add=True)
        types=models.ForeignKey('Type',on_delete=models.CASCADE)
        users=models.ForeignKey(to=User,on_delete=models.CASCADE)
        power=models.IntegerField()
        state=models.IntegerField(default=2)
        filename=models.CharField(max_length=20)
        isDelete=models.BooleanField(default=False)
        route=models.FileField(upload_to='information/',default='',max_length=100)

